package xyz.thoughtset.viewer.common.ai.model.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import xyz.thoughtset.viewer.common.ai.model.entity.purpose.BaseModelSetting;
import xyz.thoughtset.viewer.common.ai.model.entity.purpose.ChatModelSetting;
import xyz.thoughtset.viewer.common.ai.model.entity.purpose.ModelPurposeEnum;
import xyz.thoughtset.viewer.common.core.entity.BaseMeta;
import xyz.thoughtset.viewer.common.core.entity.IdMeta;
import xyz.thoughtset.viewer.common.crud.core.annotation.ApiCRUDPower;

import java.util.Map;

@TableName
@Data
@NoArgsConstructor
@ApiCRUDPower(insert = false,save = true,update = false,list = true)
public class ModelParam extends BaseMeta {
    protected String model;
    protected ModelPurposeEnum purpose;
    protected String setting;
    protected String paramJson;
    protected Integer maxMemory = 8;

    protected transient Map paramMap;
    protected transient BaseModelSetting modelArgs;

    public String chatSystemPrompt(){
        if(modelArgs!=null && modelArgs instanceof ChatModelSetting){
            return ((ChatModelSetting) modelArgs).getSystemPrompt();
        }
        return "";
    }

}
